package com.freesun.shop.controller;

import com.freesun.shop.service.DubboTestService;
import com.freesun.shop.service.DubboTestService2;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DubboTestConreoller {

    //启动消费者时，不检查此服务提供者是否启动
   /* @Reference(check = false)
    private DubboTestService dubboTestService;*/

    @Reference(check = false)
    private DubboTestService2 dubboTestService2;


    @GetMapping("/rpc/test")
    public ResponseEntity<String> testRpc(){
        String hello = dubboTestService2.sayHai();
        System.out.println("调用成功");
        return ResponseEntity.ok(hello);
    }
}
